package com.jchy.renderit.core;
 
import java.awt.Color;

public class Hit
{
    public Color    color;
    public Point    location;
    public Point    normpt;
    public boolean  isHit;
    public double   ambient;
    public double   diffuse; 
    public double   phongCoef;
    public double   phongExp;

    private Displayable target;

    public Hit()
    {
        color=new Color(0,0,0);
        location=new Point(0,0,0);
        normpt=new Point(0,0,0);
        isHit=false;
        ambient=0.2;
        diffuse=0.8;
        phongCoef=0.0;
        phongExp=1.0;
    }
    
    public Hit copy()
    {
        Hit result = new Hit();
        result.color = new Color(color.getRed(), color.getGreen(), color.getBlue());
        result.location = new Point(location.x, location.y, location.z);
        result.normpt   = new Point(normpt.x, normpt.y, normpt.z);
        result.isHit = isHit;
        result.ambient = ambient;
        result.diffuse = diffuse;
        result.phongCoef = phongCoef;
        result.phongExp = phongExp;
        result.target = target;
        return result;
    }

    public void setTarget(Displayable target) {
        this.target = target;
    }

    public Displayable getTarget() {

        return target;

    }

    public String toString()
    {
        String result;
        result = "Hit: " + isHit + 
                 "\nColor: (" + color.getRed() + ", " + 
                 color.getGreen() + ", " + color.getBlue() + ")" + 
                 "\nLocation: " + location + 
                 "\nNormal Point: " + normpt +
                 "\nAmbient: " + ambient +
                 "\nDiffuse: " + diffuse +
                 "\nPhong Coefficient: " + phongCoef +
                 "\nPhong Exponent: " + phongExp;
        return result;
    }
}

